package cn.waka.sys.admin.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.waka.sys.admin.dao.IdcDao;

@Service
public class IdcService {

	@Autowired
	private IdcDao idcDao;

	public List<Map<String,Object>> getUserLive(String start_date,String end_date,String channel){
		if(channel!=null&&!"".equals(channel)){
			return idcDao.getUserLiveByChannel(start_date,end_date,channel);
		}else{
			return idcDao.getUserLive(start_date,end_date);
		}
	}
	
	public List<Map<String,Object>> getUserNew(String start_date,String end_date,String channel,String type){
		if(channel!=null&&!"".equals(channel)){
			if("day".equals(type)){
				return idcDao.getUserNewByChannelDay(start_date,end_date,channel);
			}else if("hour".equals(type)){
				return idcDao.getUserNewByChannelHour(start_date,end_date,channel);
			}
		}else{
			if("day".equals(type)){
				return idcDao.getUserNewByDay(start_date,end_date);
			}else if("hour".equals(type)){
				return idcDao.getUserNewByHour(start_date,end_date);
			}
		}
		return null;
	}
	
	public List<Map<String,Object>> getBoxLive(String start_date,String end_date,String channel){
		if(channel!=null&&!"".equals(channel)){
			return idcDao.getBoxLiveByChannel(start_date,end_date,channel);
		}else{
			return idcDao.getBoxLive(start_date,end_date);
		}
	}
	
	public List<Map<String,Object>> getBoxNew(String start_date,String end_date,String channel,String type){
		if(channel!=null&&!"".equals(channel)){
			if("day".equals(type)){
				return idcDao.getBoxNewByChannelDay(start_date,end_date,channel);
			}else if("hour".equals(type)){
				return idcDao.getBoxNewByChannelHour(start_date,end_date,channel);
			}
		}else{
			if("day".equals(type)){
				return idcDao.getBoxNewByDay(start_date,end_date);
			}else if("hour".equals(type)){
				return idcDao.getBoxNewByHour(start_date,end_date);
			}
		}
		return null;
	}
}
